Ext.define('uploadDoc', {
    extend: 'Ext.data.Model',
    fields: [
            {name: 'docId', mapping: 'docId'},
            {name: 'showClick', mapping: 'showClick'},
 	 		{name: 'PF', mapping: 'PF'},
	 	    {name:'PN', mapping: 'PN' },
	 	    {name: 'process', mapping: 'process'},
	 	    {name: 'upDocument', mapping: 'upDocument'},
	 	    {name: 'startPage', mapping: 'startPage'},
	 	    {name:'endPage', mapping: 'endPage' },
	 	    {name: 'upRevision', mapping: 'upRevision'},
	 	    {name: 'defaul', mapping: 'defaul'},
	 	    {name: 'convert', mapping: 'convert'},
	 	    {name: 'effectiveFrom', mapping: 'effectiveFrom'},
	 	    {name: 'effectiveTo', mapping: 'effectiveTo'},
	 	    {name: 'directFromAgile', mapping: 'directFromAgile'},
	 	    {name: 'assign', mapping: 'assign'},
	 	    {name: 'value', mapping: 'value'},
	 	    {name: 'pnByPf', mapping: 'pnByPf'},
	 	    {name: 'documentType', mapping: 'documentType'},
	 	   	{name: 'routeStep', mapping: 'routeStep'},
	 	   	{name: 'shopOrder', mapping: 'shopOrder'},
	 	   	{name: 'departMent', mapping: 'departMent'},
	 	   	{name: 'workstation', mapping: 'workstation'},
	 	    {name: 'engineeringNotes', mapping: 'engineeringNotes'},
	 	    {name: 'displayEngineeringNotes', mapping: 'displayEngineeringNotes'},
	 	    {name: 'createDate', mapping: 'createDate'},
	 	   	{name: 'engineeringNotesActive', mapping: 'engineeringNotesActive'},
	 	   	{name: 'engineeringNotesSequence',mapping:'engineeringNotesSequence'},
	 	    {name: 'jobName',mapping:'jobName'},
	 	    {name: 'implementedQty',mapping:'implementedQty'},
	 	    {name: 'implementedValue',mapping:'implementedValue'},
    ]
});

var uploadDocStore = Ext.create('Ext.data.Store', {
    pageSize: 8,
    model: 'uploadDoc',
    proxy: {
        type: 'ajax',
        url:'',
        timeout: 1200000,
        reader: {
        	type: 'json',
        	root: 'uploadDocList',
        	totalProperty: 'upTotalCount'
        },
        afterRequest: function(request, success) { 
        	// hidenLoad(mainFormMask);
        }
    },
    sorters: [{
        property: 'defaul',
        direction: 'DESC'
    }]
});

Ext.define('process', {
    extend: 'Ext.data.Model',
    fields: [{
    	name: 'processName',
    	mapping: 'processName'
    }]
});

var processStore = Ext.create('Ext.data.Store', {
    model: 'process',
    proxy: {
        type: 'ajax',
        url:'',
        reader: {
        	type: 'json',
        	root: 'processList',
        	totalProperty: 'totalCount',
        }
    },
    sorters: [{
        property: 'processName',
        direction: 'ASC'
    }]
});

var column1 = [{
    header: 'ShowClick',
    dataIndex: 'showClick', 
    width: 30, 
    align: 'center'
    // renderer: showClick
	},{
	header: 'Partfamily',
	dataIndex: 'PF',     
	width:80,
	sortable: true,
	renderer:function(value,metaData){
     	// metaData.tdAttr = 'data-qtip="' + value + '"';
     	// return value;
     }
 },{
     header: 'Partnumber',
     dataIndex: 'PN',     
	 width: 80,
     sortable: true,
     renderer:function(value,metaData){
         	// metaData.tdAttr = 'data-qtip="' + value + '"';
         	// return value;
         }
 },{
     header:'Process',
     dataIndex: 'process',   
	 width: 100,
     sortable: false,
     field: {
            xtype: 'combobox',
            typeAhead: true,
            editable: false,
            triggerAction: 'all',
            selectOnTab: true,
            store: processStore,
            displayField: 'processName',
            lazyRender: true,
            listClass: 'x-combo-list-small',
            listeners: {
    			focus: {fn: function() {
    				// queryProcessBy();
    			    }
    			}   
      		}
        },
        renderer:function(value,metaData){
         	// metaData.tdAttr = 'data-qtip="' + value + '"';
         	// return value;
         }
	},{
     header:'Document',
     dataIndex: 'upDocument',     
	 width: 80,
     sortable: true,
     renderer:function(value,metaData){
         	// metaData.tdAttr = 'data-qtip="' + value + '"';
         	// return value;
         }
	},{ 
	 header:'Type',
     dataIndex: 'documentType',     
	 width: 60,
     sortable: true,
     renderer:function(value,metaData){
     	// metaData.tdAttr = 'data-qtip="' + value + '"';
     	// return value;
     }
		
	},{
     header:'Startpage',
     dataIndex: 'startPage', 
	 width: 80,
     sortable: true	,
     editor: {
    	 xtype: 'numberfield',
    	 id:'startPageId',
    	 step:1,
    	 minValue:1
     }
	},{
     header:'Endpage',
     dataIndex: 'endPage', 
	 width: 70,
     sortable: true	,
     editor: {
    	 xtype: 'numberfield',
    	 id:'endPageId',
    	 step:1
     }
	},{
     header:'Revision',
     dataIndex: 'upRevision', 
     width: 60,
    // flex:0.3,
     sortable: true	
	}
	,{
     header:'Default',
     dataIndex: 'defaul',  
     id:'DefaultId',
	 width: 60,
	// flex:0.3,
     sortable: true
	}
	,{
     header:'Convert',
     dataIndex: 'convert',  
	 width: 60,
	 //flex:1,
     sortable: true
     
	}
	,{   header:'Assign',
     dataIndex: 'assign',  
		 width: 60,
		 //flex:0.2,
	     sortable: true	
	     
		
	},{
		 header:'Value',
     dataIndex: 'value',  
		 width: 60,
		// flex:0.2,
	     sortable: true
	     
	}
	,{
     header:'Effectivefrom',
     dataIndex: 'effectiveFrom',  
	 width: 90,
	 //flex:1,
     sortable: true
     
	},{
     header:'Effectiveto',
     dataIndex: 'effectiveTo', 
	 width: 90,
	 //flex:1,
     sortable: true	
	}];


Ext.define('DocMap.view.Panel_03',{
	extend: "Ext.grid.Panel",
 	id: 'panel_03',
 	alias:'widget.panel_03',
 	height:311,
 	autoWidth: true,
 	loadMask: true,
	store:uploadDocStore,
	title:"3 Upload Document",
 	// selModel: testSm,
	anchor:"100%",
	columns:column1,
	listeners:{

	},
	tbar:[{
		id:'shopFloorId',
		width:150,
		labelWidth: 90,
		columnWidth: '0.22',
		xtype:"combo",
		labelAlign: 'left',
		// store: <portlet:namespace />sfdcHostIPStore,
		forceSelection: true,
		typeAhead: false,
		disabled: false,
		// displayField: 'customer',
		// valueField: 'fieldValue',
		labelStyle: 'font-size: 10px; font-weight:bold;',
		emptyText:'Shop Floor ID'
	},{
		xtype:'label',html:'&nbsp;&nbsp;'
	},{
		id:'byPartTypeId',
		xtype:'combo',
		emptyText:'Please Select...'
	},{
		xtype:'label',html:'&nbsp;&nbsp;'
	},{
		id:'partValueId',
		xtype:'combo',
		emptyText:'Please Select...'
	},'-',{
        id:'searchId',
		xtype:'button',
		text:'Search'
	},'->',{
		xtype:'button',
		text:'Add',
		disabled:true
	},{
		xtype:'button',
		text:'Delete',
		disabled:true
	}],
	bbar: [{
		xtype:'pagingtoolbar',
		dock: 'bottom',
		store:uploadDocStore,
        margin:'0 0 0 400'
	}]
});